package com.example.springdatajpa.dao;

import com.example.springdatajpa.entity.Order;
import org.springframework.stereotype.Repository;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 * 创建一个Dao类实现自定义的接口
 */
@Repository
public class MyOrderDaoImpl implements MyOrderReposity {
    @PersistenceContext(name="entityManagerFactory")
    private EntityManager em;
    @Override
    public Order findOrderById(Long id) {
        return em.find(Order.class,id);
    }
}
